package com.woniuxy.elasticsearch.mapper;

import com.woniuxy.elasticsearch.entity.Goods;
import org.springframework.data.domain.Pageable;
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @Author zhangyong
 * @Date 2021/8/16 0016下午 4:25
 */

/**
 * ElasticsearchRepository  指定了操作es的基本API，直接调API就可以操作ES
 * <Goods,Integer>
 *     Goods    封装成对象
 *     Integer  用@Id修饰属性的类型
 */
@Repository
public interface GoodsMapper extends ElasticsearchRepository<Goods,Integer> {
    //以名字查询
    public List<Goods> findByName(String name);
    //以名字查询并分页
    public List<Goods> findByName(String name, Pageable pageable);
    //
    public List<Goods> findByNameAndSalesprice(String name , double price);
    //
    public List<Goods> findByNameOrSalesprice(String name);
    //
    public List<Goods> findBySalespriceBetween(double begin,double end);
    //小于
    public List<Goods> findBySalespriceLessThan(double max);
    
}
